<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:include page="/WEB-INF/templateBackoffice/header.jsp"/>
<aside class="right-side">
    <section class="content-header">
        <nav class="navbar navbar-default">
            <div class="navbar-header">
                <c:choose>
                    <c:when test="${user.idUtilisateur == null}">
                        <span class="navbar-brand"> Create </span>
                    </c:when>
                    <c:otherwise>
                        <span class="navbar-brand"> Edit </span>
                    </c:otherwise>
                </c:choose>
            </div>
        </nav>
    </section>
    <section class="content">
        <div class="sonata-ba-form">
            <form method="POST" action="users?action=edit">
                <div class="box box-success">
                    <div class="box-body">
                        <div class="sonata-ba-collapsed-fields">
                                    <div class="form-group">
                                        <label class="control-label" for="login"> Login </label>
                                        <div class=" sonata-ba-field sonata-ba-field-standard-natural">
                                            <input id="login" class=" form-control" type="text" maxlength="25" name="login" value="${user.login}"/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label" for="mdp"> Password </label>
                                        <div class=" sonata-ba-field sonata-ba-field-standard-natural">
                                            <input id="pass" class=" form-control" type="password" maxlength="64" name="mdp" value="${user.mdp}"/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label" for="nom"> Nom </label>
                                        <div class=" sonata-ba-field sonata-ba-field-standard-natural ">
                                            <input id="nom" class=" form-control" type="text" maxlength="25" name="nom" value="${user.nom}" />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label" for="prenom"> Prenom </label>
                                        <div class=" sonata-ba-field sonata-ba-field-standard-natural">
                                            <input id="prenom" class=" form-control" type="text" maxlength="25" name="prenom" value="${user.prenom}" />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label" for="dateNaissance"> Date de naissance </label>
                                        <div class=" sonata-ba-field sonata-ba-field-standard-natural">
                                            <script type="text/javascript">
                                                $(function() {
                                                    $( "#naissance" ).datepicker({
                                                        dateFormat : "dd/mm/yy"
                                                    });
                                                });
                                            </script>
                                            <input id="dateNaissance" class="sonata-medium-date form-control" type="text" name="dateNaissance" value="${user.dateNaissance}">
                                        </div>
                                    </div>
                                <input class="form-control" type="hidden" name="userid" value="${user.idUtilisateur}" />
                                

                            <div class="form-group ">
                                <label class="control-label" for="adresse"> Adresse </label>
                                <div class=" sonata-ba-field sonata-ba-field-standard-natural">
                                    <input id="adresse" class=" form-control" type="text" maxlength="25" name="adresse" value="${user.adresse}" />
                                </div>
                            </div>
                            <div class="form-group ">
                                <label class="control-label" for="adresse"> Ville </label>
                                <div class=" sonata-ba-field sonata-ba-field-standard-natural">
                                    <input id="adresse" class=" form-control" type="text" maxlength="25" name="ville" value="${user.ville}" />
                                </div>
                            </div>
                            <div class="form-group ">
                                <label class="control-label" for="cp"> Code Postal </label>
                                <div class=" sonata-ba-field sonata-ba-field-standard-natural">
                                    <input id="cp" class=" form-control" type="text" maxlength="25" name="cp" value="${user.codePostal}" />
                                </div>
                            </div>
                            
                            <div class="form-group ">
                                <label class="control-label" for="tel"> Telephone </label>
                                <div class=" sonata-ba-field sonata-ba-field-standard-natural">
                                    <input id="tel" class=" form-control" type="text" maxlength="25" name="tel" value="${user.telephone}" />
                                </div>
                            </div>
                            
                            <div class="form-group ">
                                <label class="control-label" for="email"> Email </label>
                                <div class=" sonata-ba-field sonata-ba-field-standard-natural">
                                    <input id="email" class=" form-control" type="text" maxlength="25" name="email" value="${user.email}" />
                                </div>
                            </div>
                            
                         	<div class="form-group ">
                                <label class="control-label" for="valide"> Valide </label>
                                    <input id="valide" type="checkbox" maxlength="25" name="valide" value="1" 
                                    <c:if test="${user.etatProfil == true }" >
                                    checked="checked"
                                    </c:if>
                                     />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="well well-small form-actions">
                    <button class="btn btn-success" name="btn_create_and_edit" type="submit">
                        <i class="fa fa-save"></i>
                        <c:choose>
                            <c:when test="${user.idUtilisateur == null}">Create</c:when>
                            <c:otherwise>Edit</c:otherwise>
                        </c:choose>
                    </button>
                </div>
            </form>
        </div>
    </section>
</aside>
<jsp:include page="/WEB-INF/templateBackoffice/footer.jsp"/>